// pages/packetList/packetList.js 
var app = getApp()
Page({

  /**
   * 页面的初始数据 
   */
  data: {
    tabArr: {
      curHdIndex: 0,
      curBdIndex: 0,
      sendtotalnum: 0,
      resivetotalnum:0,
      sendtotalmoney: "0.00",
      resivetotalmoney:"0.00",
      resivelist:[],
      sendlist:[]
    },
  },
  tabFun: function (e) {
    //获取触发事件组件的dataset属性 
    var _datasetId = e.target.dataset.id;
    var _obj = {};
    _obj.curHdIndex = _datasetId;
    _obj.curBdIndex = _datasetId;
    this.setData({
      tabArr: _obj
    });
  },
  packetDetails: function (e) {
    console.log(e.currentTarget.dataset.id)
    wx.navigateTo({
      url: '/pages/packetDetails/packetDetails?type=' + 1 + '&id=' + e.currentTarget.dataset.id,
    })
  },
  packetDetails2: function (e) {
    wx.navigateTo({
      url: '/pages/packetDetails/packetDetails?type=' + 2 + '&id=' + e.currentTarget.dataset.id,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    wx.showLoading({
      title: '数据加载中',
    })
    var that = this;
    wx.request({
      url: app.siteinfo.rootpath+'myhb',
      method:"post",
      data:{
        id:app.siteinfo.userinfo.id
      },
      success:function(res){
        if(res.data.code == 200){
          that.setData({
            logo:app.siteinfo.userinfo.logo,
            sendtotalnum: res.data.sendtotalnum,
            sendtotalmoney: res.data.sendtotalmoney,
            resivetotalnum: res.data.resivetotalnum,
            resivetotalmoney: res.data.resivetotalmoney,
            resivelist: res.data.resivelist,
            sendlist: res.data.sendlist,
          })
        }else{
          wx.showToast({
            title: '信息获取失败',
            icon:"none"
          })
        }
      },
      complete:function(){
        wx.hideLoading()
      }
    })
  }, 

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  // onShareAppMessage: function () {

  // }
})